package com.huawei.appgallery.assistantdock.base.cardkit.card;

import android.content.Context;
import android.text.TextUtils;
import com.huawei.appgallery.assistantdock.base.cardkit.bean.BuoyBaseCardBean;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.hms.framework.common.ContainerUtils;
import o.cgz;
import o.Logger;

public class BuoyBaseCard extends cgz {
    private String ˎ;

    public BuoyBaseCard(Context context) {
        super(context);
    }

    public void ˏ(CardBean cardBean) {
        if (cardBean instanceof BuoyBaseCardBean) {
            BuoyBaseCardBean buoyBaseCardBean = (BuoyBaseCardBean) cardBean;
            buoyBaseCardBean.ˋᐝ(ॱ(buoyBaseCardBean.ॱˌ()));
            buoyBaseCardBean.ॱ(ॱ(buoyBaseCardBean));
            this.ˊᐝ = buoyBaseCardBean;
            super.ˏ(buoyBaseCardBean);
            return;
        }
        Logger.e("BuoyBaseCard", "!(data instanceof BuoyBaseCardBean)");
    }

    protected String ॱ(BuoyBaseCardBean buoyBaseCardBean) {
        String ॱॱ = buoyBaseCardBean.ॱॱ();
        Object ˎ = buoyBaseCardBean.ˎ();
        Object ـॱ = buoyBaseCardBean.ـॱ();
        if (TextUtils.isEmpty(ॱॱ)) {
            return ॱॱ;
        }
        if (!ॱॱ.startsWith("html|") && !ॱॱ.startsWith("buoy_html|")) {
            return ॱॱ;
        }
        if (!TextUtils.isEmpty(ˎ)) {
            ॱॱ = ˋ(ॱॱ, "gSource=" + ˎ);
        }
        if (TextUtils.isEmpty(ـॱ)) {
            return ॱॱ;
        }
        return ˋ(ॱॱ, "directory=" + ـॱ);
    }

    protected String ॱ(String str) {
        if (TextUtils.isEmpty(str) || TextUtils.isEmpty(ˎ())) {
            return str;
        }
        Object obj = "gscardname=" + ˎ();
        if (str.contains(obj)) {
            return str;
        }
        String str2;
        if (str.indexOf("?") == -1) {
            str2 = str + "?";
        } else {
            str2 = str + ContainerUtils.FIELD_DELIMITER;
        }
        return str2 + obj;
    }

    private String ˋ(String str, String str2) {
        if (str.contains(str2)) {
            return str;
        }
        String str3;
        if (str.indexOf("?") == -1) {
            str3 = str + "?";
        } else {
            str3 = str + ContainerUtils.FIELD_DELIMITER;
        }
        return str3 + str2;
    }

    public String ˎ() {
        return this.ˎ;
    }

    public void ˋ(String str) {
        this.ˎ = str;
    }
}
